package com.warren.response;

/**
 * @author warren
 * @date 2021/3/21 0021 13:59
 * @Description
 * 规定:
 *  #200表示成功
 *  #1001～1999 区间表示参数错误
 *  #2001～2999 区间表示用户错误
 *  #3001～3999 区间表示接口异常
 *  #后面对什么的操作自己在这里注明就行了
 **/
public enum ResultCode implements CustomizeResultCode{

    /* 成功 */
    SUCCESS(200, "成功"),

    /* 默认失败 */
    COMMON_FAIL(999, "失败"),

    /* 参数错误：1000～1999 */
    PARAM_NOT_VALID(1001, "参数无效"),
    PARAM_IS_BLANK(1002, "参数为空"),
    PARAM_TYPE_ERROR(1003, "参数类型错误"),
    PARAM_NOT_COMPLETE(1004, "参数缺失"),

    /* 用户错误 */
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_EXPIRED(2002, "账号已过期"),
    USER_CREDENTIALS_ERROR(2003, "密码错误"),
    USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
    USER_ACCOUNT_DISABLE(2005, "账号不可用"),
    USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
    USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
    USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
    USER_ACCOUNT_USE_BY_OTHERS(2009, "账号下线"),
    USER_NOT_FOUND_EXCEPTION(2010,"用户不存在"),
    USER_SESSION_INVALID(2010,"账号被挤下线"),
    /*部门错误*/
    DEPARTMENT_NOT_EXIST(3007, "部门不存在"),
    DEPARTMENT_ALREADY_EXIST(3008, "部门已存在"),
    DEPARTMENT_HAVE_USER(3009,"部门仍有人员存在"),
    /*角色错误*/
    ROLE_NOT_EXIST(4001,"角色不存在"),
    ROLE_HAVE_USER(4002,"该角色目前存在用户"),

    /* 业务错误 */
    NO_PERMISSION(3001, "没有权限"),
    PARAMETER_ERROR(3002,"入库单不存在"),
    PRODUCT_IS_REMOVE(3003,"物资已移入回收站"),
    PRODUCT_NOT_FOUND(3004,"物资找不到"),
    PRODUCT_WAIT_PASS(3004,"物资等待审核"),
    PRODUCT_STATUS_ERROR(3005,"物资状态错误"),
    PRODUCT_IN_STOCK_NUMBER_ERROR(3006,"物资入库数量非法"),
    PRODUCT_OUT_STOCK_NUMBER_ERROR(3007,"物资发放数量非法"),
    PRODUCT_IN_STOCK_EMPTY(3008,"物资入库不能为空"),
    PRODUCT_OUT_STOCK_EMPTY(3009,"物资发放不能为空"),
    PRODUCT_STOCK_ERROR(3010,"物资库存不足"),
    PARAMETER_STATUS_ERROR(3031,"入库单状态不正确"),
    /*运行时异常*/
    ARITHMETIC_EXCEPTION(9001,"算数异常"),
    /*健康异常*/
    HASH_REPORT(5001,"今日已经打卡，无法重复打卡"),
    /*限流*/
    LIMIT_ERROR(6001,"访问频率过高");


    private Integer code;

    private String message;

    ResultCode(Integer code,String message){
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
